const {Schema, model} = require('mongoose')

const tasksSchema = new Schema(
  {
    id: {
      type: String,
      required: true,
      unique: true,
    },
    title: {
      type: String,
      required: true,
    },
    text: {
      type: String,
      required: false,
    },
    startDate: {
      type: Date,
      required: true,
    },
    deadlineDate: {
      type: Date,
      required: false,
    },
    type: {
      type: String,
      required: false,
    },
    isSubtask: {
      type: Boolean,
      required: true,
    },
    parentId: {
      type: String,
      required: false,
    },
    tagsIds: {
      type: [String],
      required: false,
    },
    projectId: {
      type: String,
      required: true,
    },
    userId: {
      type: String,
      required: false,
    },
  },
  {
    versionKey: false,
  },
)

module.exports = model('Tasks', tasksSchema)
